# coding: utf-8
import pytest
import allure

from page.login.LoginPage import LoginPage


@allure.title("登录功能")  # 用例标题
@allure.feature("测试登录功能的类")  # 归为大类
class TestLoginPage():
    login_message = [
        {"username": "zhangsan", "password": "123456"},
        {"username": "lisi", "password": "123456"},
        {"username": "wangwu", "password": "123456"},
    ]

    @allure.story("登录用例")  # 归为子类
    @allure.severity(allure.severity_level.CRITICAL)  # 发生BUG时的严重程度
    @pytest.mark.parametrize("login_message", login_message)
    def test_login(self, page, login_message):
        page = LoginPage(page)
        page.login_action(login_message["username"], login_message["password"])


if __name__ == '__main__':
    pytest.main()
